package com.amigo.online.consumer.user.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.amigo.online.common.base.controller.BaseController;
import com.amigo.online.common.core.response.Response;
import com.amigo.online.common.param.dto.user.InvoiceAddressDto;
import com.amigo.online.consumer.user.service.InvoiceService;

@RestController
@RequestMapping(value="/invoice", produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
public class InvoiceController extends BaseController{
	
	@Autowired
	private InvoiceService invoiceService;
	
	@PostMapping("/update")
	ResponseEntity<Response> updateInvoiceAddress(@RequestBody InvoiceAddressDto invoiceAddressDto){
		return invoiceService.updateInvoiceAddress(invoiceAddressDto);
	}
	
	@GetMapping("/my")
	ResponseEntity<Response> selectAddressByUser(){
		return invoiceService.selectAddressByUser();
	}
	
	@PostMapping("/create")
	ResponseEntity<Response> createInvoiceAddress(@RequestBody InvoiceAddressDto invoiceAddressDto){
		return invoiceService.createInvoiceAddress(invoiceAddressDto);
	}
	
}
